package cn.kgc.spring.day03.service.impl;

import cn.kgc.spring.day03.mapper.UserMapper;
import cn.kgc.spring.day03.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author 课工场
 * @date 2024/7/15
 * @description
 *   UserServiceImpl   -> userServiceImpl
 *
 *    实现属性的初始化 可以使用
 *    @Autowired   spring框架提供的
 *    @Resource    javax.annotation.Resource
 *    byName  默认
 *    byType
 *     通过设置注解属性指定需要注入的bean
 */
@Service
public class UserServiceImplB implements UserService {

    @Resource(name ="userMapperImplB" )
    private UserMapper userMapper;


    // public void setUserMapper(UserMapper userMapper) {
    //     this.userMapper = userMapper;
    // }

    public Boolean deleteUser(Integer id) {

        System.out.println("------------UserServiceImplB----------------");
        Integer line = userMapper.deleteUser(id);
        return line == 1;
    }

}
